<?php


namespace app\api\controller\v1;

use app\api\model\Category as CategoryModel;
use app\lib\exception\CategoryException;

class Category
{
    /*
     * 获取所有分类列表
     * @url category/all
     */
    public function getAllCategories()
    {
        $category = CategoryModel::all([], 'img');
        if ($category->isEmpty()) {
            throw new CategoryException();
        }
        return $category;
    }
}